<!--
NOTE: I think it does some problems in the player, may be bigger frequency ?
CR: Magic number
-->
<%= periodically_call_remote(:url => { :action => 'get_statuses' }, :frequency => 10) %>
<!-- CR BORIS: Move to css file -->
<style>
.main_table {
	width: 100%;
}
.main_table th {
	background-color: #00CCFF;
}
.main_table td {
	background-color: #CCFFFF;
	border: 1px solid #00CCFF;
	font-size: 28px;
	padding-right: 10px;
}
.main_table .name_div {
	overflow-y: hidden;
}
#error {
	background-color: #FF0000;
}
</style>
<div id="error"></div>
<div id='operations'>
	<%= render :partial => 'operations', :layout => false %>
</div>
<table class='main_table'>
<!-- CR: Naming - @list -->
	<tr>
		<th> id </th>
		<th> name </th>
		<th> transcode </th>
		<th> status </th>
		<th> delete </th>
		<th> play </th>
		<th> download </th>
	</tr>
<% for video in @list do %>
	<% id = video.id %>
	<tr id='row_<%= id %>'>
		<td class='id_column'> <%= id %> </td>
		<td class='name_column'>
			<div class="name_div"> <%= video.name %> </div>
		 </td>
		<td class='transcode_column'> <%= link_to_remote 'transcode', :url => { :action => 'transcode', :id => id }, :update => "status_#{id}" %> </td>
		<td class='status_column' id='status_<%= id %>'>&nbsp;</td>
		<td class='delete_column' id='delete_<%= id %>'>
			<%= link_to_remote("delete", :url => { :action => 'delete', :id => id }) %>
		</td>
		<td class='play_column' id='play_<%= id %>'> 
		&nbsp;
		<% if video.ready? %>
			<%= player_object_string( video.url ) %>
		<% end %>
		</td>
		<td class='download_column' id='download_<%= id %>'>
			<%= link_to_remote("download", :url => { :action => 'download', :id => id }) %>
		</td>
	</tr>
<% end %>
</table>
